<template>
  <div class="recordinfo">
    <el-table
      :data="approveRecord"
      border
      :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
    >
      <el-table-column type="index" label="序号" width="50"></el-table-column>
      <el-table-column prop="nodeName" label="审批节点"></el-table-column>
      <el-table-column prop="handleUserName" label="处理人"></el-table-column>
      <el-table-column prop="approvePoint" label="审批意见">
        <template #default="{ row }">
          <div>
            审批结果：{{
              row.approveResult === "1" ? "验收通过" : "验收不通过"
            }}
          </div>
          <div>审批意见： {{ formatterStatusLabel(row) }}</div>
        </template>
      </el-table-column>
      <el-table-column prop="approveTime" label="审批时间"></el-table-column>
    </el-table>
  </div>
</template>

<script lang="ts" setup>
import { defineProps } from "vue";

defineProps({
  approveRecord: {
    type: Array,
    require: true,
    default: () => []
  }
});

const formatterStatusLabel = row => {
  const reg = /([^：]+)$/;
  if (row.approvePoint.includes("：")) {
    return row.approvePoint.match(reg)[1];
  } else {
    return row.approvePoint;
  }
};
</script>

<style lang="scss" scoped></style>
